﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using AirLine.Entities;
using AirLine.DataAccess;

namespace AirLine.Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract (SessionMode = SessionMode.Required)]
    public interface IAirLineService
    {

        #region Initialization
        [OperationContract(IsInitiating = true)]
        bool SignIn(string username, string password);

        #endregion

        #region Airport

        [OperationContract]
        IEnumerable<Airport> GetAllAirport();

        [OperationContract]
        IEnumerable<Airport> SearchAirport(string keyWord, int type);

        [OperationContract]
        bool InsertAirport(Airport newAirport);

        [OperationContract]
        bool UpdateAirport(Airport newAirport);

        [OperationContract]
        bool DeletetAirport(string code);

        #endregion

        #region Ticket Class
        [OperationContract]
        IEnumerable<TicketClass> GetAllTicketClass();
        [OperationContract]
        IEnumerable<SeatClass> GetAllSeatClass();
        #endregion

        #region Flight
        //[OperationContract]
        //IEnumerable<Flight> SearchFlight(SearchFlight searchFlight);
        #endregion

        #region Public Service

        [OperationContract]
        List<ISanBay> TimSanBayDi();

        [OperationContract]
        List<ISanBay> TimSanBayDen();
        #endregion

        [OperationContract]
        List<ILoaiVe> TimLoaiVe();

        [OperationContract]
        List<IChuyenBay> TimChuyenBay(string sanBayDi, string sanBayDen, DateTime thoiGianDi, DateTime thoiGianVe, string loaiVe);
    }

    [DataContract]
    public class SearchFlight
    {
        [DataMember]
        public int ShowType { get; set; }
        [DataMember]
        public int IsOneWay { get; set; }
        [DataMember]
        public int IsDirectFlight { get; set; }
        [DataMember]
        public string AirportCodeFrom { get; set; }
        [DataMember]
        public string AirportCodeTo { get; set; }
        [DataMember]
        public int FlightTypeId { get; set; }
        [DataMember]
        public string DepartureDate { get; set; }
        [DataMember]
        public string ReturnDate { get; set; }
        [DataMember]
        public int AdultsAmount { get; set; }
        [DataMember]
        public int ChildrenAmount { get; set; }
        [DataMember]
        public int SeatClassId { get; set; }
    }

    [DataContract]
    public class ISanBay
    {
        [DataMember]
        public string MaSanBay { get; set; }
        [DataMember]
        public string TenSanBay { get; set; }
        [DataMember]
        public string QuocGia { get; set; }
        [DataMember]
        public string ThanhPho { get; set; }
    }

    [DataContract]
    public class ILoaiVe
    {
        [DataMember]
        public string MaLoai { get; set; }
        [DataMember]
        public string TenLoai { get; set; }
        [DataMember]
        public double Gia { get; set; }
        [DataMember]
        public bool DuocPhepHuy { get; set; }
        [DataMember]
        public bool DuocPhepNangHang { get; set; }
        [DataMember]
        public bool DuocPhepDoiLichTrinh { get; set; }
        [DataMember]
        public double PhiHuyTruocNgayKhoiHanh { get; set; }
        [DataMember]
        public double PhiHuySauNgayKhoiHanh { get; set; }
        [DataMember]
        public double PhiNangHangTruocNgayKhoiHanh { get; set; }
        [DataMember]
        public double PhiNangHangSauNgayKhoiHanh { get; set; }
        [DataMember]
        public double PhiDoiLichTrinhTruocNgayKhoiHanh { get; set; }
        [DataMember]
        public double PhiDoiLichTrinhSauNgayKhoiHanh { get; set; }
        [DataMember]
        public double HeSoCongDam { get; set; }
        [DataMember]
        public int ThoiHanSuDung { get; set; }
        [DataMember]
        public string DonViTien { get; set; }
    }

    [DataContract]
    public class IChuyenBay
    {
        [DataMember]
        public string MaSanBayDi { get; set; }
        [DataMember]
        public string MaSanBayDen { get; set; }
        [DataMember]
        public DateTime ThoiGianDi { get; set; }
        [DataMember]
        public DateTime ThoiGianVe { get; set; }
        [DataMember]
        public string Loai { get; set; }
        [DataMember]
        public List<string> CacHangGhe { get; set; }
        [DataMember]
        public List<double> Gia { get; set; }
        [DataMember]
        public string DonViTien { get; set; }
    }

    [DataContract]
    public class IKhachHang
    {
        [DataMember]
        public string HoTen { get; set; }
        [DataMember]
        public DateTime NgaySinh { get; set; }
        [DataMember]
        public string GioiTinh { get; set; }
        [DataMember]
        public string LoaiThe { get; set; }
        [DataMember]
        public string SoThe { get; set; }
        [DataMember]
        public DateTime NgayCap { get; set; }
        [DataMember]
        public DateTime NgayHetHan { get; set; }
        [DataMember]
        public string SoTheHoiVien { get; set; }
        [DataMember]
        public string LoaiKhachHang { get; set; }
    }
}
